﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MslDiary.Module
{
    /// <summary>
    /// DiaryList.xaml 的交互逻辑
    /// </summary>
    public partial class DiaryList : UserControl
    {
        public DiaryList()
        {
            InitializeComponent();
            this.CalendarDiaryDate.PreviewMouseLeftButtonUp += Calendar_PreviewMouseUp;
            this.btnMenu.MouseMove += (s, e) =>
            {
                this.sortMenu.IsOpen = true;
            };
        }
        /// <summary>
        /// 使用 PreviewMouseLeftButtonUp 事件时无需再空点那一下鼠标
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Calendar_PreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            if (Mouse.Captured is System.Windows.Controls.Primitives.CalendarItem)
            {
                Mouse.Capture(null);
            }
        }
    }
}
